﻿<%@ Page Title="" Language="C#" MasterPageFile="~/InputCtrl.Master" AutoEventWireup="true" CodeBehind="ValidatorServices.aspx.cs" Inherits="LiveDemo.InputCtrl.ValidatorServices" %>
<%@ Register
    Assembly="AjaxControlToolkit"
    Namespace="AjaxControlToolkit"
    TagPrefix="AjaxToolkit" %>
<%@ Register assembly="System.Web.Silverlight" namespace="System.Web.UI.SilverlightControls" tagprefix="asp" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <script type="text/javascript">
        function onSourceDownloadProgressChanged(sender, eventArgs) {
            var value = 0;
            if (eventArgs.progress) {
                value = eventArgs.progress;
            }
            else {
                value = eventArgs.get_progress();
            }
            sender.get_element().content.findName("progressBar").Width = value * sender.get_element().content.findName("progressBarBackground").Width;
        }
    </script> 
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <div class="logo_SlInputCtrl"></div>
    <div class="heading">
        ValidatorServices Description and Concept
    </div>
    <div>
        <p>
            ValidatorServices is an <b>Set Service Attach</b> to validate of text that can be entered. The service modify the behavior textchanged and/or Leaved to validate and accepts multiple validations for the same element. 
        </p>
        <p>
            For correct operation <b>must define a context</b> of validation that should contain all the elements that are part of the validation process. The service will be controlled by <b>ValidatorMananger</b> that stores the data validation within the scope of application of x defined context.
        </p>
        <p>
            When the validation fails the default behavior is to <b>paint the border of the red</b> and the error message is displayed in <b>Tooltip</b>.
        </p>
    </div>
    
    <asp:Panel ID="Services_HeaderPanel" runat="server" Style="cursor: pointer;">
        <div class="heading">
            <asp:ImageButton ID="Services_ToggleImage" runat="server" ImageUrl="~/Images/collapse.jpg" />
            List of services
        </div>
    </asp:Panel>
    
    <asp:Panel ID="Services_ContentPanel" runat="server" Style="overflow: hidden; padding:5px" Height="0px">
        <p>
        <span class="subheading">
        NewContext:
        </span>
        Sets a validation context.
        </p>
        <p>
        <span class="subheading">
        Validators:
        </span>
        Defines a set of validators for the element. It may contain one or more validators.
        </p>
        <p>
        <span class="subheading">
        Behavior:
        </span>
        Define the behavior for a set of validators applied to the element.
        </p>
        <span class="subheading">
        Element ErrorMessage:
        </span>
        Defines an element associated with the set of validators for customizing the presentation of the error message. When associated vivibled property is set to collapse and changed to visibled when an error occurs.
        </p>
        <span class="subheading">
        ValidatorManager:
        </span>
        It is the manager of the validators in the context. 
        </p>
    </asp:Panel>
    
    <Ajaxtoolkit:collapsiblepanelextender ID="Collapsiblepanelextender2" runat="Server"
        TargetControlID="Services_ContentPanel"   
        ExpandControlID="Services_HeaderPanel" 
        CollapseControlID="Services_HeaderPanel"
        CollapsedImage ="~/Images/collapse.jpg"
        ExpandedImage ="~/Images/expand.jpg"
        Collapsed="true" 
        SuppressPostBack ="true"
        ImageControlID="Services_ToggleImage" />

    <asp:Panel ID="Samples_HeaderPanel" runat="server" Style="cursor: pointer;">
        <div class="heading">
            <asp:ImageButton ID="Samples_ToggleImage" runat="server" ImageUrl="~/Images/collapse.jpg" />
            Samples of Validation
        </div>
    </asp:Panel>
    
    <asp:Panel ID="Samples_ContentPanel" runat="server" Style="overflow: hidden; padding:5px" Height="0px">
        <ul>
            <li>
               <a href="RequiredValidator.aspx"><b>RequiredValidator</b></a><br /><br /> 
            </li>
            <li>
               <a href="LengthValidator.aspx"><b>LengthValidator</b></a><br /><br /> 
            </li>
            <li>
               <a href="RangeValidator.aspx"><b>RangeValidator</b></a><br /><br /> 
            </li>
            <li>
               <a href="RegExpressionValidator.aspx"><b>RegExpressionValidator</b></a><br /><br /> 
            </li>
            <li>
               <a href="CompareValidator.aspx"><b>CompareValidator</b></a><br /><br /> 
            </li>
            <li>
               <a href="CustomValidator.aspx"><b>CustomValidator</b></a><br /><br /><br /> 
            </li>
            <li>
               <a href="MultValidator.aspx"><b>Multiple Validators</b></a><br /><br />
            </li>
            <li>
               <a href="WorkingGroup.aspx"><b>Working With Groups</b></a><br /><br />
            </li>
            <li>
               <a href="Attachedbehavior.aspx"><b>Attached behavior</b></a><br /><br />
            </li>
            <li>
               <a href="AttachedErrorMessage.aspx"><b>Attached ElementErrorMessage</b></a><br /><br />
            </li>
        </ul>
    </asp:Panel>
    
    <Ajaxtoolkit:collapsiblepanelextender ID="Collapsiblepanelextender3" runat="Server"
        TargetControlID="Samples_ContentPanel"   
        ExpandControlID="Samples_HeaderPanel" 
        CollapseControlID="Samples_HeaderPanel"
        CollapsedImage ="~/Images/collapse.jpg"
        ExpandedImage ="~/Images/expand.jpg"
        Collapsed="false" 
        SuppressPostBack ="true"
        ImageControlID="Samples_ToggleImage" />

    <asp:Panel ID="description_HeaderPanel" runat="server" Style="cursor: pointer;">
        <div class="heading">
            <asp:ImageButton ID="Description_ToggleImage" runat="server" ImageUrl="~/Images/collapse.jpg" />
            ValidatorManager
        </div>
    </asp:Panel>
    
    <asp:Panel ID="description_ContentPanel" runat="server" Style="overflow: hidden; padding:5px" Height="0px">
        The validatorManager is a static object that controls all the validators that are defined in a context.
        <p>
        Note: There can be only one context at a time. When creating a new context the latter is eliminated.
        </p>                     
        <p>
        The following methods are available:
        </p>
            <span class="subheading">
            GetConextValidator()
            </span>
            Returns the FrameworkElement that contains the context of validation
        <p>
        </p>
        <p>
            <span class="subheading">
            ValidateAll():
            </span>
            Performs validation on the associated control at all entrances of the context.
        </p>
        <p>
            <span class="subheading">
            GetAllErrors():
            </span>
            Performs method ValidateAll() and Return <b>string Array</b> with <b>message erros</b>.
        </p>
        <p>
            <span class="subheading">
            Validate():
            </span>
            Performs validation on the associated control at all entrances of the context in which the group is empty.
        </p>
        <p>
            <span class="subheading">
            GetErrors():
            </span>
            Performs method Validate() and Return <b>string Array</b> with <b>message erros</b>.
        </p>
        <p>
            <span class="subheading">
            Validate(GroupName):
            </span>
            Performs validation on the associated control at all entrances of the context in which the group is equal to the parameter passed.
        </p>
        <p>
            <span class="subheading">
            GetErrors(GroupName):
            </span>
            Performs method Validate(GroupName) and Return <b>string Array</b> with <b>message erros</b>.
        </p>
        <p>
            <span class="subheading">
            ResetAllValidators():
            </span>
            Performs reset on the all entrances of the context. The property <b>IsValidResult</b> is set to false and border and tooltip are restored to original state.
        </p>
        <p>
            <span class="subheading">
            ResetValidators():
            </span>
            Performs reset on the all entrances of the context in which the group is empty. The property <b>IsValidResult</b> is set to false and border and tooltip are restored to original state.
        </p>
        <p>
            <span class="subheading">
            ResetValidators(GroupName):
            </span>
            Performs reset on the all entrances of the context in which the group is equal to the parameter passed. The property <b>IsValidResult</b> is set to false and border and tooltip are restored to original state.
        </p>
        <p>
            <span class="subheading">
            DisabledGroup(GroupName):
            </span>
            Performs disabled on the all entrances of the context in which the group is equal to the parameter passed.The property <b>IsValidResult</b> always return <b>true</b> and border and tooltip are restored to original state.
        </p>
        <p>
            <span class="subheading">
            EnabledGroup(GroupName):
            </span>
            Performs Enabled on the all entrances of the context in which the group is equal to the parameter passed.
        </p>
    </asp:Panel>
    
    <Ajaxtoolkit:collapsiblepanelextender ID="cpeDescription" runat="Server"
        TargetControlID="description_ContentPanel"   
        ExpandControlID="description_HeaderPanel" 
        CollapseControlID="description_HeaderPanel"
        CollapsedImage ="~/Images/collapse.jpg"
        ExpandedImage ="~/Images/expand.jpg"
        Collapsed="true" 
        SuppressPostBack ="true"
        ImageControlID="description_ToggleImage" />

    <asp:Panel ID="properties_HeaderPanel" runat="server" Style="cursor: pointer;">
        <div class="heading">
            <asp:ImageButton ID="Properties_ToggleImage" runat="server" ImageUrl="~/images/expand.jpg" AlternateText="expand"  />
            Properties for all Validators
        </div>
    </asp:Panel>
    
    <asp:Panel ID="properties_ContentPanel" runat="server" Style="overflow: hidden;" Height="0px">
        <span class="heading">Dependency Properties</span>
        <p>
            <span class="subheading">
            Enabled:
            </span>
            If false, validator is NOT evaluation. Default value is true. When false, the method <em><b>Validator</b></em> always returns true.
        </p>
        <p>
            <span class="subheading">
            PropertyToValidate:
            </span>
            Name the property to validation. Default value is empty. <b>Overrider</b> PropertyToValidate in <b>ValidatorCollection Tag</b>.
            When the value is empty, the validation is permitted for the following types of valid elements :
        </p>
        <ul>
            <li>
                TextBox : Property Text;
            </li>
            <li>
                PasswordBox : Property Password;
            </li>
        </ul>
        <p>
        When the property contains a value, the validation can be performed on any element and value will be converted to type string.
        </p>
        <p>
            <span class="subheading">
            ErrorMessage:
            </span>
            Message displayed when result of validation is false.Default value is empty.
        </p>
        <p>
            <span class="subheading">
            Group:
            </span>
            The name of the validation group to which this validation control belongs.Default value is empty.
        </p>
        <span class="heading">Read Only Properties</span>
        <p>
            <span class="subheading">
            ElementValidator:
            </span>
            Framework Element to validation.
        </p>
        <p>
            <span class="subheading">
            IsValidResult:
            </span>
            If true, the validation was successful.
        </p>
</asp:Panel>

    <ajaxToolkit:CollapsiblePanelExtender ID="cpeProperties" runat="Server"
        TargetControlID="properties_ContentPanel"
        ExpandControlID="properties_HeaderPanel"
        CollapseControlID="properties_HeaderPanel"
        SuppressPostBack ="true"
        CollapsedImage ="~/Images/expand.jpg"
        ExpandedImage ="~/Images/collapse.jpg"
        Collapsed="True"
        ImageControlID="properties_ToggleImage" />

    <asp:Panel ID="Method_HeaderPanel" runat="server" Style="cursor: pointer;">
        <div class="heading">
            <asp:ImageButton ID="Method_ToggleImage" runat="server" ImageUrl="~/Images/collapse.jpg" />
            Methods for all Validators
        </div>
    </asp:Panel>

    <asp:Panel ID="Method_ContentPanel" runat="server" Style="overflow: hidden; padding:5px" Height="0px">
        <span class="subheading">
        Validate():
        </span>
        Method: Performs validation on the associated input control and updates the <em><b>IsValidResult</b></em> property
    </asp:Panel>
      
    <Ajaxtoolkit:collapsiblepanelextender ID="Collapsiblepanelextender1" runat="Server"
        TargetControlID="Method_ContentPanel"   
        ExpandControlID="Method_HeaderPanel" 
        CollapseControlID="Method_HeaderPanel"
        CollapsedImage ="~/Images/collapse.jpg"
        ExpandedImage ="~/Images/expand.jpg"
        Collapsed="true" 
        SuppressPostBack ="true"
        ImageControlID="Method_ToggleImage" />


</asp:Content>
